package eerr.llrr.oorr.pte9983.b.wifimaster.splash.module;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import eerr.llrr.oorr.pte9983.b.wifimaster.lanch.NewLanchManager;
import yyee.llee.mmee.pl190.host668.BFactory;
import yyee.llee.mmee.pl190.host668.StrongContext;

public abstract class ModuleBaseFragment extends Fragment {

    private static final String TAG = "ModuleBaseFragment";

    private AppCompatActivity mActviity;

    @Override
    public void onAttach(@NonNull Context context) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        super.onAttach(context);
        this.mActviity = (AppCompatActivity) context;
    }

    public void mOnRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        if (mActviity == null) {
            return;
        }
        onPerFinish();
    }

    protected abstract void onPerFinish();

    public void toMain() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        Log.d(TAG, "toMain() called");
        /**
         * 判断是否是走审核包
         */
        if (!NewLanchManager.isCommon() && BFactory.getNorMainActivity() != null) {
            BFactory.setMainActivity(BFactory.getNorMainActivity());
        }
        /**
         *  open api  体外跳转的逻辑
         *
         *  1. 以 outpage: 开头
         *  2.
         */
        if (mActviity == null) {
            Intent intent = new Intent(StrongContext.getApplication(), BFactory.getMainActivity());
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            StrongContext.getApplication().startActivity(intent);
            return;
        }
        Intent intent = mActviity.getIntent();
        if (intent != null) {
            String openApi = intent.getStringExtra("OpenApi");
            if (!TextUtils.isEmpty(openApi)) {
                if (openApi.startsWith("outpage:")) {
                    String[] split = openApi.split(":");
                    if (split.length > 1) {
                        String route = split[1];
                        if (!TextUtils.isEmpty(route)) {
                            // TODO 没有给inPage赋值,获取的值为空,所以这里注释掉
                            // Class aClass = RouteJump.INSTANCE.getInPage().get(route);
                            // if (aClass != null) {
                            // if (isAdded()) {
                            // startActivity(new Intent(mActviity, aClass));
                            // mActviity.finish();
                            // } else {
                            // toStory(aClass);
                            // }
                            // 
                            // return;
                            // }
                            Log.d(TAG, "openApi class is  null");
                        }
                        Log.d(TAG, "openApi is empty");
                    }
                    Log.d(TAG, "openApi no route");
                }
                Log.d(TAG, "openApi 格式有误");
            }
        }
        if (isAdded()) {
            startActivity(new Intent(mActviity, BFactory.getMainActivity()));
            mActviity.finish();
        } else {
            Intent newIntent = new Intent(StrongContext.getApplication(), BFactory.getMainActivity());
            newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            StrongContext.getApplication().startActivity(newIntent);
        }
    }

    private void toStory(Class aClass) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        Intent intent = new Intent(StrongContext.getApplication(), aClass);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        StrongContext.getApplication().startActivity(intent);
    }
}
